package com.lpf.flyweight;

// 客户端代码
public class FlyweightPatternDemo {
    public static void main(String[] args) {
        // 创建字符工厂
        CharacterFactory factory = new CharacterFactory();

        // 使用共享字符对象
        String text = "Hello, world!";
        for (char c : text.toCharArray()) {
            MyCharacter character = factory.getCharacter(c);
            character.display(12); // 假设字体大小为12
        }
    }
}